import request from './index.js'

// 分类相关接口
export const categoryApi = {
    // 获取分类列表
    getList: (params) => {
        return request({
            url: '/category/list',
            method: 'get',
            params
        })
    },
    // 获取分类详情
    getDetail: (id) => {
        return request({
            url: `/category/${id}`,
            method: 'get'
        })
    },
    // 获取分类下的商品
    getCategoryProducts: (categoryId, params) => {
        return request({
            url: `/category/${categoryId}/products`,
            method: 'get',
            params
        })
    },
    // 获取子分类
    getSubCategories: (parentId) => {
        return request({
            url: `/category/sub/${parentId}`,
            method: 'get'
        })
    }
} 